<template>
  <div>
    <!-- 头部开始 -->
    <div class="header">
      <div class="left">
        <h2>
          <img src="yangchaung//images/图片 (1).png" @click="fun()" />
          景点/周边游
        </h2>
      </div>
      <div class="right">
        <div class="has">
          <span class="iconfont icon-ditu2"></span>地图
        </div>
        <span class="iconfont icon-gengduo" style="margin-right: 4.533vw"></span>
      </div>
    </div>
    <!-- 搜索框开始 -->
    <div class="search">
      <span class="xian">西安</span>
      <span id="magnifier" class="iconfont icon-fangdajing"></span>
      <span class="line">|</span>
      <input type="text" placeholder="露营" />
    </div>
    <!-- 图标导航栏开始 mock数据-->
    <div class="picnav">
      <div v-for="(v, i) in arr" :key="i">
        <img :src="v.imgsrc" alt />
        <p>{{ v.tittle }}</p>
      </div>
    </div>
    <!-- 景点排行开始 -->
    <div class="Ranking">
      <div v-for="(v, i) in arr1" :key="i + 1">
        <h5>{{ v.h5 }}</h5>
        <p>{{ v.p }}</p>
        <img :src="v.imgsrc" />
      </div>
    </div>
    <!-- 路由导航开始 -->
    <div class="allrout">
      <div class="routnav">
        <div>
          <img src="mayingshuang/imgs/lou.jpg" />
          <router-link to="/allattractions">全部景点</router-link>
        </div>
        <div>
          <img src="mayingshuang/imgs/pubu.jpg" />
          <router-link to="/goodplace">发现好去处</router-link>
        </div>
      </div>
    </div>
    <router-view />
  </div>
</template>

<script>
import axios from "axios";
import home from "@/components/mayingshaung/HomeNav.vue";
// import home from '../../components/mayingshaung/home.vue'
export default {
  components: { home },

  // 点击返回上个页面
  methods: {
    fun() {
      this.$router.go(-1);
    }
  },
  data() {
    return {
      arr: [],
      arr1: [],
      arr2: []
    };
  },
  mounted() {
    axios.request("http://localhost:8889/spicnav").then(ok => {
      console.log(ok);
      this.arr = ok.data;
    }),
      axios.request("http://localhost:8889/Ranking").then(ok => {
        console.log(ok);
        this.arr1 = ok.data;
      }),
      axios.request("http://localhost:8889/allnav").then(ok => {
        console.log(ok);
        this.arr2 = ok.data;
      });
  }
};
</script>

<style lang="scss" scoped>
* {
  margin: 0;
  padding: 0;
}
// 头部样式开始
.header {
  width: 100%;
  height: 8.8vw;
  display: flex;
  justify-content: space-between;
  line-height: 8.8vw;
  .left {
    height: 8.8vw;
    line-height: 8.8vw;
    margin-left: 2.667vw;
    h2 {
      display: flex;
      justify-content: space-between;
      img {
        width: 5.333vw;
        height: 6.133vw;
        margin-top: 1.333vw;
      }
    }
  }
  .right {
    display: flex;
    justify-content: space-between;
  }
}
// 搜索框样式开始
.search {
  margin-top: 4.8vw;
  position: relative;
  input {
    width: 96vw;
    height: 8.267vw;
    border-radius: 5.2vw;
    text-align: center;
  }
  .xian {
    position: absolute;
    top: 1.867vw;
    left: 5.333vw;
  }
  #magnifier {
    position: absolute;
    top: 2.133vw;
    left: 40vw;
  }
  .line {
    position: absolute;
    top: 2.4vw;
    left: 17.333vw;
  }
}
// 图片导航栏开始
.picnav {
  width: 100%;
  height: 32vw;
  margin-top: 4vw;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  div {
    width: 16.8vw;
    height: 14.133vw;
    // background-color: red;
    font-size: 2.667vw;
  }
  img {
    width: 11.8vw;
    height: 9.867vw;
  }
}
.Ranking {
  width: 100%;
  height: 17.067vw;
  display: flex;
  justify-content: space-around;
  margin-top: 9.6vw;

  div {
    width: 16.8vw;
    height: 16.8vw;
    // background-color: red;
    position: relative;
    h5 {
      position: absolute;
      top: 1.067vw;
      left: 0.267vw;
      font-size: 4vw;
    }
    p {
      position: absolute;
      top: 5.867vw;
      left: 0.267vw;
      font-size: 2.133vw;
      color: #777777;
    }
    img {
      width: 6.933vw;
      height: 5.333vw;
      position: absolute;
      top: 11.2vw;
      left: 10.4vw;
    }
  }
}
// 路由导航样式开始
.allrout {
  width: 100%;
  height: 5.333vw;
  // background-color: red;
  margin-top: 6.667vw;
  .routnav {
    width: 57.6vw;
    height: 5.333vw;
    display: flex;
    justify-content: space-between;
    a {
      margin-left: 1.333vw;
      // line-height: 4.267vw;
      // color: black;
      font-size: 4.267vw;
    }
    .allnav {
      width: 25.333vw;
      height: 5.333vw;
    }
    img {
      width: 5.6vw;
      height: 5.333vw;
    }
  }
}
</style>